package org.dromara.common.core.enums;

import org.springframework.util.StringUtils;

/**
 * Created by fly on 2014/12/11.
 */
public enum BusiEnum {
    KTXB("ktxb", "看图寻宝"),
    OPS("ops", "运维"),
    ALS("als", "股票分析"),
    SHOP("shop", "商城"),
    YHJ("yhj", "优惠卷");

    BusiEnum(String code, String desc) {
        this.desc = desc;
        this.code = code;
    }


    String desc;
    String code;

    public static BusiEnum valueOfCode(String code) {

        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (BusiEnum status : BusiEnum.values()) {
            if (status.getCode().toLowerCase().equals(code.toLowerCase())) {
                return status;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + ":" + desc;
    }
}
